package com.woniuxy.myshop.config;

import com.alibaba.druid.pool.DruidDataSource;
import org.springframework.beans.factory.annotation.Configurable;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration  //相当于Spring的配置文件 可以实例化对象到容器
public class DataSourceConfig {

    @Bean  // 相当于 Spring的配置文件中的 <bean id="方法名" class="" />
    @ConfigurationProperties(
            prefix = "spring.datasource"
    )
    public DruidDataSource druidDataSource(){
        return new DruidDataSource();
    }
}
